package com.googlecode.jvmpart.proc.jdbc;

import java.sql.ResultSet;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.googlecode.jvmpart.Partitioner;
import com.googlecode.jvmpart.proc.JvmProcessException;


/**
 * Get the jdbc metadata in the parameters passed from the partitioner{@link Partitioner},
 * and prepare a connection
 * @author chunzhan.he
 *
 */
public abstract class SimpleRowProcessor extends RowProcessor {
	private static final Log logger = LogFactory.getLog(SimpleRowProcessor.class);

	@Override
	public void allProcessed(long processed, long error) throws JvmProcessException {
		logger.info("Processed:"+processed+" Error:"+ error);
	}

	@Override
	public boolean whenError(ResultSet rs, long row, Throwable t) {
		logger.info("Row:"+row);
		logger.warn(t,t);
		return false;
	}
}
